package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.bean.User;

import java.util.List;

@Mapper
public interface UserMapper {
    // 通过用户名密码查询用户数据
    User getByUserNameAndPassword(User user);

    List<User> getAllUser();

    User getUserById(Long id);

    int insUser(User stu);

    int updUser(User stu);

    int delUserById(Long id);

    @Select("select * from `user`")
    List<User> getAllUser2();

    @Select("select * from `user` where id=#{id}")
    User getUserById2(Long id);

    @Insert("INSERT INTO `user`(username, password, email) VALUES (#{username},#{password},#{email})")
    int insUser2(User user);

    @Update("UPDATE `user` SET username=#{username}, password=#{password}, email=#{email} WHERE id=#{id}")
    int updUser2(User user);

    @Delete("delete from `user` where id=${id}")
    int delUserById2(Long id);
}